import axios from 'axios'

axios.defaults.baseURL = 'http://119.91.117.43:9090'

export default function requestData(url,data = {},type='GET') {
    return new Promise((resolve,reject)=>{
        let promise

        if(type=='GET') {
            promise = axios.get(url,{
                params:data
            })
        }else{
            promise = axios.post(url,{
                params:data
            })
        }

        promise.then((response) => {
            resolve(response);
        }).catch((error) => {
            console.error("数据请求异常！", error)
        })
    })
}